﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DroidClaim.Web.Service;
using DroidClaim.Web.Models;
namespace DroidClaim.Web.Mapper
{
	public class SurveyorMapper
	{
		public static SurveyorModel DtoToModel(SurveyorDto inputDto) 
		{
			SurveyorModel result = new  SurveyorModel();

									result.Id = inputDto.Id;
											result.SurveyerId = inputDto.SurveyerId;
											result.Username = inputDto.Username;
											result.Password = inputDto.Password;
											result.Salt = inputDto.Salt;
											result.Name = inputDto.Name;
											result.Surname = inputDto.Surname;
											result.Mobile = inputDto.Mobile;
											result.Email = inputDto.Email;
											result.PicturePath = inputDto.PicturePath;
											result.Code = inputDto.Code;
					 
						if(inputDto.SurveyorLocation != null)
                          {
							result.SurveyorLocation = inputDto.SurveyorLocation.Id;
							result.SurveyorLocationCode = inputDto.SurveyorLocation.Code;
							result.SurveyorLocationName = inputDto.SurveyorLocation.Name;
						  }
							
			return result;
		}

		    	
        public static SurveyorDto ModelToDto(SurveyorModel inputModel)
        { 
		
			SurveyorDto result = new  SurveyorDto
        
			{ 

									Id = inputModel.Id,
							
                
									SurveyerId = inputModel.SurveyerId,
							
                
									Username = inputModel.Username,
							
                
									Password = inputModel.Password,
							
                
									Salt = inputModel.Salt,
							
                
									Name = inputModel.Name,
							
                
									Surname = inputModel.Surname,
							
                
									Mobile = inputModel.Mobile,
							
                
									Email = inputModel.Email,
							
                
									PicturePath = inputModel.PicturePath,
							
                
									Code = inputModel.Code,
							
                
										 SurveyorLocation = new SurveyorLocationDto() {Id = inputModel.SurveyorLocation },
				   			
                
				 };
            return result;
        }

	}
}